<?php
namespace app\api\controller;
use app\common\controller\Api;

class Order extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = '*';

    public function orderList(){
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
        header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
        $userInfo = $this->auth->getUserinfo();
        $page = $this->request->request("page");
        $list = db("yjy_order a")
            ->join("yjy_house b","a.house_id = b.id","LEFT")
            ->join("yjy_house_layout c","b.layout_id = c.id","LEFT")
            ->join("user d","d.id = a.user_id","LEFT")
            ->field("a.house_id,a.id,b.title,b.image,b.images,b.location_near,b.price,c.name,b.tags_ids,d.nickname,d.mobile")
            ->field("from_unixtime(a.ordertime,'%m/%d %H:%i') as ordertime")
            ->where("a.agent_id",$userInfo['id'])
            ->paginate(6);
        //foreach($list as $key=>$val){
           //explode(',',$val['tags_id]);
        //}
        $this->success("返回成功",$list);
    }







}